package com.keepsoft.core;

import com.keepsoft.core.entity.PictureFile;
import com.keepsoft.core.service.IHelloService;
import com.keepsoft.util.ReadPng;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;

@RestController
public class helloController {

    @Autowired
    IHelloService helloService;

    @RequestMapping("")
    public String hello(){
        return "hello";
    }

    @RequestMapping("/readPng")
    @ResponseBody
    public ArrayList readPng(){
        ReadPng readPng=new ReadPng();
        ArrayList<PictureFile> list=readPng.getFiles("C:\\\\Users\\\\Administrator\\\\Desktop\\\\201712");

        ArrayList<HashMap> list1=new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            HashMap map=helloService.getFile(list.get(i).getFILE_CD());
            list1.add(map);
        }
        return list1;
    }
}
